#include"Processbar.h"
//设置一个场景
//double filesize=100*1024*1024*1.0;//总的文件大小
//double currentsize=0.0;//目前下载的文件数
double bandwidth=1024*1024*1.0;
void Download(double filesize,callbact_t cb)
{
  double currentsize=0.0;
    printf("Download begin,currentsize:%lf\n",currentsize);
  while(currentsize <= filesize)
  {
    cb(filesize,currentsize);
    usleep(20000);
    currentsize+=bandwidth;
  }
     printf("\nDownload done,currentsize:%lf\n",currentsize);
}
int main()
{
  Download(100*1024*1024*1.0,ProcBar);
  Download(200*1024*1024,ProcBar);
  Download(400*1024*1024,ProcBar);
  Download(50*1024*1024,ProcBar);
  Download(10*1024*1024,ProcBar);
 //ProcBar();
 //test();
  return 0;
}
